﻿package mortal.game.view.mainUI.smallMap.view.render
{
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.display.*;
    import flash.events.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.systemSetting.*;
    import mortal.mvc.core.*;

    public class SmallMapShowItem extends GSprite
    {
        private var _icon:GBitmap;
        private var _txt:GTextFiled;
        private var _box:GCheckBox;
        private var _line:ScaleBitmap;
        private var _type:uint;

        public function SmallMapShowItem()
        {
            return;
        }// end function

        public function updateData(param1:Object) : void
        {
            var _loc_2:* = param1["icon"];
            var _loc_3:* = param1["name"];
            var _loc_4:* = !ClientSetting.local.getIsDone(uint(param1["type"]));
            this._type = uint(param1["type"]);
            this._icon.bitmapData = GlobalClass.getBitmapData(_loc_2);
            this._txt.text = _loc_3;
            this._box.selected = _loc_4;
            this._box.configEventListener(Event.CHANGE, this.selectedChangeHandler);
            return;
        }// end function

        private function selectedChangeHandler(event:Event) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.SmallMapShowTypeChange, {type:this._type, value:!this._box.selected}));
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._icon = UIFactory.gBitmap("", 0, 0, this);
            this._txt = UIFactory.gTextField("", 22, 0, 220, 20, this);
            this._txt.textColor = 16246466;
            this._box = UIFactory.checkBox("", 164, 2, 16, 16, this);
            this._line = UIFactory.bg(0, 21, 220, 2, this, ImagesConst.SplitLine);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._icon.dispose(param1);
            this._txt.dispose(param1);
            this._box.dispose(param1);
            this._line.dispose(param1);
            this._icon = null;
            this._txt = null;
            this._box = null;
            this._line = null;
            return;
        }// end function

    }
}
